Method for intel platform detection of parameters in flash rom

ABSTRACT

A method for Intel platform detection of parameters in a flash ROM, relating to the technical field of servers: before OPMENU and OPTYPE registers are locked in a PEI state, storing the data in an SFDP table in a HOB, and then storing the data in a memory of an EfiACPIMemoryNVS type in a DXE stage; the data can be acquired by means of invoking driving on the application layer; the acquisition of various flash ROM parameters is more convenient, facilitating checking whether the parameters are the same as those written in the program; product performance and product stability are increased, and the occurrence of bugs is reduced.

FIELD

The present disclosure relates to the technical field of servers, and in particular, to a method for acquiring a parameter in a Flash Rom in an Intel platform.

BACKGROUND

In design of a PC and a server, a BIOS program is generally stored in a Flash Rom, and many parameters in the Flash Rom are required in a source code. At present, normally a specification provided by a ROM manufacturer is used to retrieve the required parameters to be added into programs. An error of the parameters may cause a crash of a system in a post process, or cause a probability of crash. But generally it is difficult to discover a problem caused by incorrect configuration of the FLASH ROM parameters. In order to facilitate check on the parameters of the Flash Rom, it is necessary to design a method to read these parameters. Detailed parameters of the Flash Rom are stored in a SFDP Table thereof, and any required parameters can be found in the SFDP Table.

It is not required to access the SFDP table for just reading an ID or a size of the Flash Rom. But the detailed parameters in the Flash Rom and supported functions thereof can be acquired only by reading the SFDP Table. An Intel platform has some restrictions on accessing the Flash Rom, that is, any accessing commands can only be used after being stored in an OPMENU register and an OPTYPE register. For example, a command to read the SFDP table is 0x5A. In a case that this command is not in the OPMEUN register, the SFDP cannot be read. In fact, 0x5A is not in the OPMENU register by default, and the two registers are locked at a PEI stage. Therefore, the SFDP table cannot be read after the system is started.

TECHNICAL ISSUE

In view of development requirement and deficiency of conventional technology, a method for acquiring a parameter in a Flash Rom in an Intel platform or an ARM platform is provided according to the present disclosure.

SOLUTION TO PROBLEM Technical Solution

The method for acquiring a parameter in a Flash Rom in an Intel platform according to the present disclosure addresses the above technical issue by adopting the following technical solution. Main steps of the technical solution includes: 1) saving, at a PEI stage in booting and before an OPMENU register and an OPTYPE registers are locked, values of the OPMENU register and the OPTYPE register; 2) filling a command 0x5A for reading a SFDP table into the OPMENU register and the OPTYPE register; 3) storing data of the SFDP table in a built HOB; 4) storing, at a DXE stage, data in the HOB into an applied EfiACPIMemoryNVS memory; and 5) reading, by calling a driver in a system, the data from the EfiACPIMemoryNVS memory.

Preferably, after storing the data of the SFDP table in the built HOB, the values of the OPMENU register and the OPTYPE register are restored, and the OPMENU register and the OPTYPE register are locked.

Preferably, a software program and the driver are written at an OS side, and the driver is called to acquire the data of the SFDP table at an application layer.

BENEFICIAL EFFECT OF SOLUTION Beneficial Effect

In comparison with the conventional technology, the method for acquiring a parameter in a Flash Rom in an Intel platform according to the present disclosure has following beneficial effects. According to the present disclosure, the data in the SFDP table is stored in the HOB (hand off block) before the OPMENU register and the OPTYPE register are locked at the PEI stage, and then the data is stored in the EfiACPIMemoryNVS type of memory in the DXE stage. The data can be acquired at the application layer by calling the driver. Therefore, it is convenient to acquire the parameters in the Flash Rom, so as to check whether the parameters are consistent with parameters filled in the program. Therefore, product functions can be increased, an occurrence rate of bugs is reduced, and product stability is improved. All kinds of servers or memories can implement the method by cooperation between upper-layer software codes of a BIOS and an OS, without adding any hardware circuitry.

BRIEF DESCRIPTION OF THE DRAWINGS Drawing Description

FIG. 1 is a flow chart of a method for acquiring a parameter in a Flash Rom in an Intel platform.

DETAILED DESCRIPTION Embodiments

In order to make objectives, technical solutions and advantages of the present disclosure more clear, hereinafter a method for acquiring a parameter in a Flash Rom in an Intel platform according to the present disclosure is further described in details in conjunction with specific embodiments.

In order to facilitate acquiring various parameters in a Flash Rom, a method for acquiring a parameter in the Flash Rom in an Intel platform is provided according to the present disclosure. The method is implemented by some bios codes. Data in a SFDP table is stored in a HOB (hand off block) before the OPMENU register and the OPTYPE register are locked, and the data is stored in an EfiACPIMemoryNVS type of memory at a DXE stage, so that the data can be acquired at an application layer by calling a driver in a system.

Embodiment

When a system is powered on, the UEFI BIOS boot process roughly includes stages of SEC, PEI, DXE, and BDS. The method for acquiring a parameter in a Flash Rom in an Intel platform described according to the embodiment mainly includes the following steps. In step 1), values of the OPMENU register and the OPTYPE register are saved, before the OPMENU register and the OPTYPE register are locked at the PEI stage in system booting. In step 2), a command 0x5A for reading a SFDP table is filled into the OPMENU register and the OPTYPE register. In step 3), data of the SFDP table is stored into the built HOB. In step 4), the data in the HOB is stored into an applied EfiACPIMemoryNVS memory at the DXE stage, and 5) the data is read from the EfiACPIMemoryNVS memory by calling the driver in the system, so as to check whether the data is consistent with parameters filled in a program.

FIG. 1 is a flow chart of a method for acquiring a parameter in a Flash Rom in the Intel platform. As shown in FIG. 1, a specific implementing process includes steps 1 to 5.

In step 1, values of the OPMENU register and the OPTYPE register are saved, before the OPMENU register and the OPTYPE register are locked at the PEI stage in booting.

In step 2, the command 0x5A for reading the SFDP table is filled into the OPMENU register and the OPTYPE register.

In step 3, the data of the SFDP table is stored into the built HOB.

In step 4, the values of the OPMENU register and the OPTYPE register are restored, and the OPMENU register and the OPTYPE register are locked.

In step 5, the data in the HOB is stored into the applied EfiACPIMemoryNVS memory at the DXE stage.

In step 6, a software program and a driver are written at an OS side, to read the data of the SFDP table from the EfiACPIMemoryNVS memory.

At the PEI stage after the system is powered on, the OPMENU register and the OPTYPE register of the PCH (namely, a South Bridge) are filled with default values, and the values in the two registers are saved before the registers are locked. Then, the command 0x5A for reading the SFDP table is filled into the OPMENU register and the OPTYPE register. After reading the data of the SFDP table, the data is stored into the built HOB. Then, previous values the OPMENU register and the OPTYPE register are restored. In a subsequent BIOS program, the OPMENU register and the OPTYPE register are locked, so as to prevent a following BIOS program and an OS program from changing the two registers. Finally, the data in the HOB (SFDP table data) is stored in the EfiACPIMemoryNVS type of memory at the DXE stage. Thereby, the data can be acquired at the application layer by calling the driver in the system, so as to check whether the data is consistent with the parameters filled in the program.

The aforementioned specific embodiments are only specific examples of the present disclosure, and the scope of the patent protection of the present disclosure includes, but is not limited to, the aforementioned specific embodiments. What conforms to claims of the present disclosure, or appropriate modification or replacement thereof made by those skilled in the art, should all fall within the scope of the patent protection of the present disclosure. 

1. A method for acquiring a parameter in a Flash Rom in an Intel platform, comprising: 1) saving, at a PEI stage in booting and before an OPMENU register and an OPTYPE registers are locked, values of the OPMENU register and the OPTYPE register; 2) filling a command 0x5A for reading a SFDP table into the OPMENU register and the OPTYPE register; 3) storing data of the SFDP table in a built HOB; 4) storing, at a DXE stage, data in the HOB into an applied EfiACPIMemoryNVS memory; and 5) reading, by calling a driver in a system, the data from the EfiACPIMemoryNVS memory.
 2. The method for acquiring a parameter in a Flash Rom in an Intel platform according to claim 1, wherein after storing the data of the SFDP table in the built HOB, the method further comprises: restoring the values of the OPMENU register and the OPTYPE register, and locking the OPMENU register and the OPTYPE register.
 3. The method for acquiring a parameter in a Flash Rom in an Intel platform according to claim 2, further comprising: writing a software program and the driver at an OS side, wherein the driver is called to acquire the data of the SFDP table at an application layer. 